<template>
  <div class="item van-hairline--bottom">
    <!-- <h3>
      {{ item.title }}
    </h3> -->
    <!-- 使用v-html渲染标题 让span解析 -->
    <h3
      @click="$router.push(`/shareDetail/${item.id}`)"
      v-html="item.title"
    ></h3>
    <div class="desc" @click="$router.push(`/shareDetail/${item.id}`)">
      {{ item.content }}
    </div>
    <div class="detail-box">
      <div class="user">
        <img :src="item.author.avatar" alt="" />
        {{ item.author.nickname }}
      </div>
      <div class="time">
        <!--formatTime 全局过滤器  -->
        {{ item.created_at | formatTime }}
      </div>
      <div class="comment">
        <i class="iconfont iconicon_pinglunliang"></i>
        {{ item.article_comments }}
      </div>
      <div class="star">
        <i class="iconfont iconicon_dianzanliang"></i>
        {{ item.star }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'MMShareItem',
  props: {
    item: {
      type: Object
    }
  }
}
</script>

<style lang="less" scoped>
.item {
  padding-bottom: 10px;
  h3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    /deep/ span {
      color: @main-color;
    }
  }
  .desc {
    font-size: 12px;
    color: @subdominant-font-color;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-bottom: 20px;
  }
  .detail-box {
    display: flex;
    align-items: center;
    .user {
      display: flex;
      align-items: center;
      color: @subdominant-font-color;
      font-size: 12px;
      flex: 1;
      img {
        width: 22px;
        height: 22px;
        border-radius: 50%;
        margin-right: 10px;
      }
    }
    .time,
    .comment,
    .star {
      font-size: 12px;
      color: @minor-font-color;
    }
    .time {
      margin-right: 20px;
    }
    .comment {
      margin-right: 20px;
      display: flex;
      align-items: center;
      i {
        font-size: 16px;
      }
    }
    .star {
      display: flex;
      align-items: center;
      i {
        font-size: 16px;
      }
    }
  }
}
</style>
